package demo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhouWeiBo
 * @create 2022/6/8
 */
public class Trunk implements Statistical{
    List<Statistical> child = new ArrayList<>();

    public void add(Statistical child){
        this.child.add(child);
    }

    public void remove(Statistical child){
        this.child.remove(child);
    }

    public List<Statistical> getChild(){
        return child;
    }

    @Override
    public long getCount() {
        long count = 0;
        for (Statistical c : child){
            count += c.getCount();
        }
        return count;
    }
}
